package day1031.demo03;

import java.util.concurrent.locks.Lock;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-10-31 10:32
 **/
public class MyTicket implements Runnable {
    private int ticket=100;
    //思考:多个线程 都是对这100票进行操作。
    @Override
    public void run() {
        while (true){
              if(ticket>0){
                  System.out.println(Thread.currentThread().getName()+"卖了一张票，剩余:"+--ticket);
              }else{
                  break;
              }
        }
    }
}
